//
// Created by xuyang on 2019/1/11.
//

#include <sys/stat.h>
#include <fcntl.h>
#include <zconf.h>
#include <printf.h>

#define FIFO_NAME "/Users/xuyang/workface/cpp/file_demo/a12.txt"
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
int main(){
    int a=mkfifo(FIFO_NAME,FILE_MODE);
    int readfifo = open(FIFO_NAME,O_RDONLY,0);
    while (1){
        char buffer[100];
        read(readfifo,buffer,100);
        printf("读取内容如下:%s\n",buffer);
    }
    return 0;
}